package com.cn.serverline.lineicp.productionLine.controller;

import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.GetResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.PostResource;
import javax.annotation.Resource;
import javax.validation.Valid;

import com.cn.serverline.lineicp.productionLine.param.ProcessStepsAddParam;
import com.cn.serverline.lineicp.productionLine.param.ProcessStepsEditParam;
import com.cn.serverline.lineicp.productionLine.param.ProcessStepsIdParam;
import com.cn.serverline.lineicp.productionLine.param.ProcessStepsPageParam;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import com.cn.serverline.lineicp.productionLine.entity.ProcessSteps;
import com.cn.serverline.lineicp.productionLine.service.IProcessStepsService;
import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData;
import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


/**
 * 工序工步 接口
 *
 * @author Gmr
 * @since 2024-07-30
 */
@RestController
@Api(tags = "工序工步")
@ApiResource(name = "工序工步的接口")
@Validated
public class ProcessStepsController {

    @Resource(name = "ProcessStepsServiceImpl")
    private IProcessStepsService iProcessStepsService;

    /**
     * 添加工序工步表
     */
    @ApiOperation(value = "添加工序工步")
    @PostResource(name = "添加工序工步", path = "/productionLine/processSteps/add")
    public ResponseData<?> add(@RequestBody @Valid ProcessStepsAddParam processSteps){
        iProcessStepsService.add(processSteps);
        return new SuccessResponseData<>();
    }

    /**
     * 批量删除工序工步表
     */
    @ApiOperation(value = "批量删除工序工步")
    @PostResource(name = "批量删除工序工步", path = "/productionLine/processSteps/deleteBatch")
    public ResponseData<?> delete(@RequestBody @Valid List<ProcessStepsIdParam> idParamList){
        iProcessStepsService.del(idParamList);
        return new SuccessResponseData<>();
    }

    /**
     * 编辑工序工步表
     */
    @ApiOperation(value = "编辑工序工步")
    @PostResource(name = "编辑工序工步", path = "/productionLine/processSteps/edit")
    public ResponseData<?> edit(@RequestBody @Valid ProcessStepsEditParam processSteps) {
        iProcessStepsService.edit(processSteps);
        return new SuccessResponseData<>();
    }

    /**
     * 分页查询-工序工步表列表
     */
    @ApiOperation(value = "分页查询-工序工步列表")
    @GetResource(name = "分页查询-工序工步表列", path = "/productionLine/processSteps/page")
    public ResponseData<PageResult<ProcessSteps>> page(@Valid ProcessStepsPageParam processSteps) {
        return new SuccessResponseData<>(iProcessStepsService.findPage(processSteps));
    }

}
